<template>
    <div class="photoinfo-container">
        <h3>{{ photoInfo.title }}</h3>
        <p class="sub-title">
            <span>发表时间:{{ photoInfo.add_time | dateFormat }}</span>
            <span>点击:{{ photoInfo.click }}次</span>
        </p>
        <hr/>
        <!-- 缩略图区域 -->
        <!-- <img class="preview-img" v-for="(item,index) in list" :src="item.src"
        height="100" @click="$preview.open(index,list)" :key="item.src"> -->
        <vue-preview :slides="list" @close="handleClose"></vue-preview>

        <!-- 评论区域 -->
        <div class="content" >{{ photoInfo.content }}</div>
        <cmt-box></cmt-box>
    </div>
</template>
<script>
import comment from '../subcomponents/comment.vue'
export default {
    data(){
        return {
            id:this.$route.params.id,
            photoInfo:{},
            list:[]
        }
    },
    created(){
        this.getPhotoInfo();
        this.getThumbs()
    },
    methods:{
        getPhotoInfo(){
            this.$http.get('photoInfo.json').then(result =>{
                if(result.body.status === 0){
                    this.photoInfo = result.body.message[0]
                    console.log( result.body.message[0])
                }
            })
        },
        getThumbs(){
            this.$http.get('suoluetu.json').then(result => {
                if(result.body.status === 0){
                    result.body.message.forEach(item => {
                        item.w = 600;
                        item.h = 400
                    });
                    this.list = result.body.message
                }
            })
        },
        handleClose () {}
    },
    components:{
        "cmt-box":comment
    }
}
</script>
<style lang="less" scoped>
.photoinfo-container{
    padding: 3px;
    h3{
        font-size: 15px;
        color: #26a2ff;
        text-align: center;
        margin: 15px 0;
    }
    .sub-title{
        font-size: 13px;
        display: flex;
        justify-content: space-between;
    }

    .content{
        font-size: 13px;
        line-height: 30px;
    }
}

</style>


